package org.code.mallspringboot.controller;

import org.code.mallspringboot.pojo.OmsOrderSetting;
import org.code.mallspringboot.service.OmsOrderSettingService;
import org.code.mallspringboot.vo.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/orderSetting")
public class OmsOrderSettingController {
    @Autowired
    private OmsOrderSettingService omsOrderSettingService;
    @GetMapping("{id}")
    public CommonResult getOrderSetting(@PathVariable Long id) {
        OmsOrderSetting omsOrderSetting=omsOrderSettingService.selectByOrderId(id);
        return CommonResult.success(omsOrderSetting);
    }
    @PostMapping("/update/{id}")
    public CommonResult updateOrderSetting(@PathVariable Long id, @RequestBody OmsOrderSetting orderSetting) {
        orderSetting.setId(id);
        int i=omsOrderSettingService.updateByOrderId(orderSetting);
        if (i<0){
            return CommonResult.failed();
        }
        return CommonResult.success("");
    }
}
